package com.ushine.design.design.c_behavioral_pattern.b_command.d_undo;

/**
 * 命令发送者
 *
 * @author yls
 */
public class CalcutionForm {
    private AbstractCommand command;

    public void setCommand(AbstractCommand command) {
        this.command = command;
    }

    public void compute(int value) {
        int i = command.execute(value);
        System.out.println("执行结果为：" + i);
    }

    public void undo() {
        int i = command.undo();
        System.out.println("执行撤销，运算结果为：" + i);
    }
}
